﻿using System;
using Microsoft.SharePoint.Administration;

namespace SharePoint.Contrib.Diagnostics
{
    /// <summary>
    /// Encapsulates behaviour for logging trace messages and exceptions via SharePoint
    /// </summary>
    public interface IDiagnosticsService
    {
        /// <summary>
        /// Logs the exception via the Windows event log and SharePoint ULS log
        /// </summary>
        /// <param name="area">the DiagnosticsArea to use</param>
        /// <param name="category">the DiagnosticsCategory to use</param>
        /// <param name="exception">the exception log</param>
        void HandleException(string area, string category, Exception exception);

        /// <summary>
        /// Logs a message via the SharePoint ULS log
        /// </summary>
        /// <param name="area">the DiagnosticsArea to use</param>
        /// <param name="category">the DiagnosticsCategory to use</param>
        /// <param name="message">the message to log</param>
        /// <param name="args">optional args to string.format</param>
        void Trace(string area, string category, string message, params object[] args);

        /// <summary>
        /// Logs a message via the SharePoint ULS log
        /// </summary>
        /// <param name="area">the DiagnosticsArea to use</param>
        /// <param name="category">the DiagnosticsCategory to use</param>
        /// <param name="messageId">the message id</param>
        /// <param name="message">the message to log</param>
        /// <param name="args">optional args to string.format</param>
        void Trace(string area, string category, int messageId, string message, params object[] args);
    }
}
